# 导入redis数据的类
from redis import StrictRedis


class Config():
    # 设置密钥
    SECRET_KEY = 'AEHNJAFJ3AHI3OAKGH4T-SHFAKEUHFAH'
    # 配置调试信息
    DEBUG = None
    # 配置mysql数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/infotest1'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 抽取具体值
    REDIS_IP = '127.0.0.1'
    REDIS_PORT = 6379

    # 设置session存储到数据库中
    SESSION_TYPE = 'redis'
    SESSION_REDIS = StrictRedis(host=REDIS_IP, port=REDIS_PORT)
    SESSION_USE_SIGNER = True # 签名信息

    # session有效期
    PERMANENT_SESSION_LIFETIME = 86400


# 定义开发模式下的配置
class DevelopmentConfig(Config):
    DEBUG = True


# 定义生成模式下的配置
class ProducttionConfig(Config):
    DEBUG = False


# 定义字典映射不同环境下的配置
config_dict = {
    "development" : DevelopmentConfig,
    "producttion" : ProducttionConfig
}



